// $Id: transport.h 88 2011-10-17 18:00:11Z cedric.shih@gmail.com $
/*
 * Copyright 2011 Cedric Shih (cedric dot shih at gmail dot com)
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 2.1 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 */

#ifndef TRANSPORT_H_
#define TRANSPORT_H_

#ifdef __cplusplus
extern "C" {
#endif

#include <sys/tree.h>
#include <niortsp/transport.h>

#include "rtp.h"

struct niortp_transport_entry {
	unsigned char payload_type;
	enum niortp_transport_type type;
	struct niortp_transport transporter;
	RB_ENTRY(niortp_transport_entry) entry;
};

RB_HEAD(niortp_transport_map, niortp_transport_entry);

int niortp_transport_map_add(struct niortp_transport_map *map,
		unsigned char payload_type, enum niortp_transport_type type,
		struct niortp_transport *transporter);

struct niortp_transport *niortp_transport_map_find(
		struct niortp_transport_map *map,
		unsigned char payload_type, enum niortp_transport_type type);

void niortp_transport_map_clear(struct niortp_transport_map *map);

int niortp_transport_entry_compare(
		struct niortp_transport_entry *a,
		struct niortp_transport_entry *b);

RB_PROTOTYPE(niortp_transport_map, niortp_transport_entry, next,
		niortp_transport_entry_compare);

#ifdef __cplusplus
}
#endif

#endif /* TRANSPORT_H_ */
